<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
<!--    <link th:href="@{/asserts/css/bootstrap.min.css}" rel="stylesheet" type="text/css"/>-->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="panel panel-default" style="width: 70%;margin: 20px auto">
    <div class="panel-heading">管理员信息查询</div>
    <div class="panel-body">
        <form method="post" th:action="@{/manager/listui}" class="form-inline">
            管理员名称： <input type="text" name="manager_name" class="form-control" th:value="${qb.manager_name}"/>
            状态：
            <select name="manager_status" class="form-control">
                <option value="">请选择状态</option>
                <option value="正常" th:selected="${qb.manager_status=='正常'}">正常</option>
                <option value="停用" th:selected="${qb.manager_status=='停用'}">停用</option>
            </select>
            <button type="submit" class="btn btn-info">查询</button>

        </form>
    </div>
</div>

<table class="table table-bordered table-hover table-striped table-condensed" style="width: 70%;margin: 20px auto">
    <thead>
    <tr>
        <th>管理员id</th>
        <th>管理员名称</th>
        <th>管理员角色</th>
        <th>管理员状态</th>
        <th>操作</th>
    </tr>
    <tbody>
    <!--循环展示管理员
    ${pb.list}:相当于掉用法了pageInfo类型对象的getList方法
    -->

    <tr th:each="manager:${pb.list}">
        <td th:text="${manager.manager_id}"></td>
        <td th:text="${manager.manager_name}"></td>
        <td th:text="${manager.manager_role}"></td>
        <td th:text="${manager.manager_status}"></td>
        <td>
            <a  class="btn btn-success btn-xs" th:if="${manager.manager_status=='停用'}" th:href="@{/manager/updstatus(manager_id=${manager.manager_id})}">启用</a>
            <a  class="btn btn-danger btn-xs" th:if="${manager.manager_status=='正常'}"  th:href="@{/manager/updstatus(manager_id=${manager.manager_id})}">停用</a>

            <a  class="btn btn-danger btn-xs" th:href="@{/manager/restpwd(manager_id=${manager.manager_id})}"   >重置密码</a>
        </td>
    </tr>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="12" align="center">
            <ul class="pagination">
                <li><a th:href="@{/manager/listui(currentPage=${pb.pageNum-1})}">&laquo;</a></li>
                <!--1 2 3 4 5 应该循环查询pages:总页码
                 url传值： /mananer/listui?currentPage=1
                -->

                <li  th:class="${pb.pageNum==i?'active':''}" th:each="i:${#numbers.sequence(1,pb.pages)}"><a th:href="@{/manager/listui(currentPage=${i})}" th:text="${i}"></a></li>

                <li><a th:href="@{/manager/listui(currentPage=${pb.pageNum+1})}">&raquo;</a></li>
            </ul>

        </td>

    </tr>





    </tfoot>
</table>


<script>
    //@{/manager/listui(currentPage=${i})}
    //index:表示的是页码
    function goPage(index){

        //将当前页的信息保存到隐藏域中
        searhForm.currentPage.value=index;
        //可以以js的方式进行表单提交
        searhForm.submit();
    }
</script>
<!--<script type="text/javascript" th:src="@{/asserts/js/jquery-1.12.3.min.js}"></script>-->
<!--<script type="text/javascript" th:src="@{/asserts/js/bootstrap.min.js}"></script>-->
</body>
</html>